package com.cn.suplayer;

import android.app.AlarmManager;
import android.app.Application;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 * Created by ZLM on 2016/6/17.
 * TODO: Write something
 */
public class app extends Application{


    private static  final boolean isDeBug=true;
    @Override
    public void onCreate() {
        super.onCreate();

        //异常处理
        Thread.UncaughtExceptionHandler uncaughtExceptionHandler = new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread thread, final Throwable ex) {
                if (isDeBug) {
                    Log.e("error",ex+ "");
                    Intent intent = new Intent(app.this, CrashActivity.class);
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    intent.putExtra("exception", ex);
                    startActivity(intent);
                    android.os.Process.killProcess(android.os.Process.myPid());
                }
            }
        };

        Thread.setDefaultUncaughtExceptionHandler(uncaughtExceptionHandler);
    }
}
